<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>

</body>

</html>
<script>
    function VueRouter() {

    }
    //原型对象方法  location跳转路由配置参数  resolve 成功 reject 失败
    VueRouter.prototype.push = function (location, resolve, reject) {
         console.log(this);
        return new Promise(resolve, reject);
    }
    VueRouter.prototype.push = function (location, resolve, reject) {
         console.log(this);
        return new Promise(resolve, reject);
    }
    //模拟VC:$router
    let vc = { $router: new VueRouter };
    let result = vc.$router.push({ path: '/search' }, () => { }, () => { });
    console.log(result);
</script>